package com.beta.dto.cart;

import com.beta.dto.order.OrderItemDto;
import com.beta.entity.Receivers;
import com.beta.support.OrderItemCollector;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * Created by vector on 2017/2/6.
 */
@Getter
@Setter
public class CartSettleDto implements Serializable {

    private List<Integer> cartItemIds;

    private List<OrderItemDto> orderItems;

    private List<Receivers> receivers;

    public BigDecimal getPrice() {
        return OrderItemCollector.getPrice(this.getOrderItems());
    }

    public BigDecimal getWeight() {
        return OrderItemCollector.getWeight(this.getOrderItems());
    }

    public BigDecimal getFreight() {
        return OrderItemCollector.getFreight(this.getOrderItems());
    }

    public BigDecimal getAmount() {
        return this.getPrice().add(this.getFreight());
    }

    public Integer getQuantity() {
        return OrderItemCollector.getQuantity(this.getOrderItems());
    }

}
